package cn.harry.constant;


import java.io.File;
import java.util.HashMap;

/**
 * 流程枚举
 *
 * @author zgn
 * @date 2022/2/16 0016
 */
public class GxDataCenTempEnum {

    //#模板路径
    public static String filePath = System.getProperty("user.dir") + "/src/main/resources/template/gx/datacn".replace("/", File.separator);

    //#代码生成器，配置信息
    public static String mainPath = "com.hclink";
    public static String packageName = "com.hclink";//#包名
    public static String moduleName = "datacenter";//#模块名;bpm;fee;workorder
    public static String author = "zgn";//#作者
    public static String email = "";//#Email

    //#表前缀(类名不会包含表前缀)
    public static String tablePrefix = "ext_";
    //#序列化(json转换和前端转换对象)
    public static boolean jsonAll = false;
    public static boolean isPK = true;//#true :无主键,默认第一个;false 不设置
    //#Copyright
    public static String copyright="www.baidu.com";
    //模板路径隐射
    public static HashMap<String,String> templates = new HashMap();

    public static HashMap<String,String> getTemplates() {
        /*templates.put("Controller.java.vm", "main.java.packageName.moduleName.controller.classNameController@java");
        templates.put("Service.java.vm", "main.java.packageName.moduleName.service.classNameService@java");*/
        templates.put("Model.java.vm", "main.java.packageName.moduleName.model.className@java");
        /*templates.put("Mapper.java.vm", "main.java.packageName.moduleName.mapper.classNameMapper@java");

        templates.put("Mapper.xml.vm", "main.resources.mapper.contract_dormitory.classNameMapper@xml");*/
        return templates;
    }
    /**
     * 生成文件路径
     *
     * @param templateMapKey    模板Map路径
     * @param className   类名(第一个字母大写),如:sys_user => SysUser
     * @param packageName 包名
     * @param moduleName  模块名
     * @return packagePath，如：main/java/moduleName/tempName/className类型.类型
     * @auther zgn
     * @date 2022/1/4 0004
     **/
    public static String getFileName(String templateMapKey, String className, String packageName, String moduleName) {
        //String classname = StringUtils.uncapitalize(className);

        return templates.get(templateMapKey)
                .replace("packageName", packageName)
                .replace("moduleName", moduleName)
                .replace("className", className)
                .replace(".", File.separator)
                .replace("@", ".");

    }

}
